import request from '@/utils/request.js'
import { useTokenStore } from '@/stores/token.js'
//家庭补贴列表查询
export const familyListService = () =>{
    //发送请求前调用usetokenstore得到token
    const tokenStore = useTokenStore();

    //通过请求头的方式把token携带给服务器 头的名称以及头的值
    //在pinia中定义的响应式数据都不需要.value
    // return request.get('/category',{headers:{'Autorization':tokenStore.token}})

    //添加了请求拦截器后不需携带token
    return request.get('/family/selectAll')
}

//添加接口 jason 格式参数
export const familyAddService = (familyData) =>{
    return request.post('/family/insert',familyData)
}

//家庭修改 需要json格式参数
export const familyUpdateService = (familyData) =>{
    return request.put('family/update',familyData)
}

//家庭删除
export const familyDeleteService = (familyId) =>{
    return request.delete('family/delete?familyId='+familyId)
}


//按需查找 自动拼接到selectNeed?userId=1
export const familySelectNeedService = (familyData) =>{
    return request.get('/family/selectNeed',{params:familyData})
}